package com.henry.chatkit.messages.holder

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.henry.chatkit.messages.MessageInfo
import com.henry.chatkit.messages.MessageProperties
import com.henry.chatkit.messages.MessageListAdapter
import com.henry.chatkit.OnItemClickListener

abstract class MessageBaseHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

    protected var rootView: View = itemView

    var mAdapter: MessageListAdapter? = null
    protected var onItemClickListener: OnItemClickListener? = null
    var properties: MessageProperties = MessageProperties.getInstance()

    fun setAdapter(adapter: RecyclerView.Adapter<*>) {
        mAdapter = adapter as MessageListAdapter
    }

    @JvmName("setOnItemClickListener1")
    fun setOnItemClickListener(listener: OnItemClickListener) {
        this.onItemClickListener = listener
    }

    abstract fun layoutViews(msg: MessageInfo?, position: Int)

}